﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tetris
{
    class Drawer
    {

        public Drawer()
        {
            Console.CursorVisible = false;
        }

        public void DrawGameField(GameField field, char symbol)
        {
            int frameX = field.X - 1;
            int frameY = field.Y - 1;
            int frameHeight = field.Height + 2;
            int frameWidth = field.Width + 2;

            for (int i = 0; i < frameHeight; i++)
            {
                Console.ForegroundColor = ConsoleColor.Gray;
                Console.SetCursorPosition(frameX, frameY + i);
                for (int j = 0; j < frameWidth; j++)
                {
                    if (i == 0 )
                        Console.Write(" ");
                    else if (i == frameHeight - 1)
                        Console.Write(symbol);
                    else if (j == 0 || j == frameWidth - 1)
                        Console.Write(symbol);
                    else Console.Write(" ");

                }
                Console.WriteLine("\n");
            }
        }

        public void DrawNode(Node node)
        {
            Console.SetCursorPosition(node.X, node.Y);
            Console.WriteLine('0');
        }

        public void ClearNode(Node node)
        {
            Console.SetCursorPosition(node.X, node.Y);
            Console.WriteLine(' ');
        }
    }
}
